package com.example.rabbitmq.controller.confirm;

import com.example.rabbitmq.Constants;
import com.rabbitmq.client.Channel;
import jakarta.annotation.Resource;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import java.io.IOException;

//@Component
//public class ConfirmQueueListener {
//
//    @RabbitListener(queues = Constants.CONFIRM_QUEUE)
//    public void listenerQueue(Message message, Channel channel) throws IOException {
//        System.out.printf("接收到的消息: %s,diveryTag:%d ",new String(message.getBody()),
//                message.getMessageProperties().getDeliveryTag());
//        try {
//            channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
//        } catch (Exception e) {
//            System.out.println("接收消息失败");
//            channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,false);
//        }
//    }
//}
